package com.jxs.android.weiget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jxs.android.ges.R;

public class Bu_Protocl_Item extends LinearLayout {

	private TextView index,// 序号

			agreement_name,// 协议名称

			create_date,// 签约日期

			detain_type_name,// 预警类型

			end_date;// 到期日期

	public Bu_Protocl_Item(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public Bu_Protocl_Item(Context context) {
		this(context, null);
	}

	private void init(Context context) {
		LayoutInflater.from(context).inflate(R.layout.bu_table_view_protocl_item, this);

		index = (TextView) findViewById(R.id.index);
		agreement_name = (TextView) findViewById(R.id.agreement_name);
		create_date = (TextView) findViewById(R.id.create_date);
		end_date = (TextView) findViewById(R.id.end_date);
		detain_type_name = (TextView) findViewById(R.id.detain_type_name);
	}

	public void setBackgroud(int resid) {
		index.setBackgroundResource(resid);
		agreement_name.setBackgroundResource(resid);
		create_date.setBackgroundResource(resid);
		end_date.setBackgroundResource(resid);
		detain_type_name.setBackgroundResource(resid);
	}

	public void setTextColor(int resid) {
		index.setTextColor(resid);
		agreement_name.setTextColor(resid);
		create_date.setTextColor(resid);
		end_date.setTextColor(resid);
		detain_type_name.setTextColor(resid);
	}

	public void setValue(String i_index, String i_agreement_name, String i_create_date, String i_end_date, String i_detain_type_name) {
		index.setText(i_index);
		agreement_name.setText(i_agreement_name);
		create_date.setText(i_create_date);
		end_date.setText(i_end_date);
		detain_type_name.setText(i_detain_type_name);
	}

	public void setagreement_nameGravityCenter() {
		agreement_name.setGravity(Gravity.CENTER);
	}

}